<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">

<title>电子文档系统</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
	<script type="text/javascript" src="view/jquery/jquery-1.9.1.js"></script>
	<script type="text/javascript" src="view/bootstrap/js/bootstrap.js"></script>
	<link rel="stylesheet" href="view/bootstrap/css/bootstrap.css">
	<link rel="stylesheet" href="view/css/docMan.css">
	<link rel="stylesheet" href="view/toastr/toastr.css">
	<script type="text/javascript" src="view/js/docMan.js"></script>
	<script type="text/javascript" src="view/toastr/toastr.min.js"></script>
	<script type="text/javascript" src="view/js/ajaxfileupload.js"></script>
	<script type="text/javascript" src="view/datapicker/laydate.js"></script>
	<link rel="stylesheet" href="view/css/searchInput.css">
	<link rel="stylesheet" href="view/datapicker/need/laydate.css">
<link rel="stylesheet" href="view/datapicker/skins/molv/laydate.css">
  </head>
  <body style="background: #ffffff;">
  	<div id="main-container" class="container" style="height: 100%;width:95%;background: #ffffff">
  		<div class="row" style="height: 100%">
  			<div id="left-p" class="col-sm-2" style="height: 100%;border-right: 1px solid #d2d2d2;"></div>
  			<div  class="col-sm-12" style="height: 100%;">
  				<div class="row mt_10" style="height:100%;width: 100%">
  					<form id="searchForm" action="pageSearch.action" method="post" onkeydown="if(event.keyCode==13){return false;}" >
  						<div class="jq22-search-form">
					        <div id="search-bd" class="search-bd">
					            <ul>
					                <li value="0" <s:if test='pageLucene.searchType=="0"'>class="selected"</s:if> >全文</li>
					                <li value="1" <s:if test='pageLucene.searchType=="1"'>class="selected"</s:if>>标题</li>
					                <li value="2" <s:if test='pageLucene.searchType=="2"'>class="selected"</s:if> class="">文号</li>
					            </ul>
					        </div>
					        <div id="search-hd" class="search-hd">
					            <div class="search-bg"></div>
					            <input type="hidden" id="searchType" value="0" name="pageLucene.searchType" >
					            <input type="text" id="s2" class="search-input" name="pageLucene.searchText" value='<s:property value="pageLucene.searchText" />' style="display: inline-block;padding: 17px 5px;">
					            <span class="s1 pholder" style="display: none;"></span>
					            <span class="s2 pholder" style="display: none;"></span>
					            <span class="s3 pholder" style="display: none;"></span>
					            <button id="btn_search" class="btn-search" value="搜索"style="font-size:14px;font-family:'Microsoft YaHei';">搜索</button>
					        </div>
					    </div>
						<div class="row" style="margin-top: 10px;">
							<h5 style="cursor: pointer;float:left;line-height:1.9;" id="high_search">高级<span id="icon" class="glyphicon glyphicon-chevron-right" style="color:#BABABB;margin-left:3px;" aria-hidden="true"></span></h5>
							<div id="div_time" class="col-md-6" style="width: 60%;display:none;">
								从<input id="startDate"  class="form-control laydate-icon" value='<s:date name="pageLucene.startDate" format="yyyy-MM-dd"/>' name="pageLucene.startDate" style="margin-right:10px;margin-left:10px;padding:3px 4px;font-size:13px;width:140px;display:inline;height:30px;" />至
		  						<input id="endDate" class="form-control laydate-icon" value='<s:date name="pageLucene.endDate" format="yyyy-MM-dd"/>' name="pageLucene.endDate" style="margin-right:10px;margin-left:10px;padding:3px 4px;font-size:13px;width:140px;display:inline;height:30px;" />
		  						搜索范围<select class="form-control" name="pageLucene.indexFrom"
								style="width:100px;display:inline;margin:5px;height:30px;font-size:13px;" >
								<option value="-1" <s:if test='pageLucene.indexFrom=="-1"'>selected="selected"</s:if> >不限范围</option>
								<option value="0" <s:if test='pageLucene.indexFrom=="0"'>selected="selected"</s:if>>本系统内</option>
								<option value="1" <s:if test='pageLucene.indexFrom=="1"'>selected="selected"</s:if>>OA系统</option>
								</select>
							</div>
							<div id="div_lwdw" class="col-md-6" style="height:50px;padding: 0px;display: none;">
								<h5 style="display: inline;margin-right: 10px;float:left;display: inline;">来文单位:</h5>
								<div style="float:left;display: inline;height:40px;border-left: 5px solid #CEE4F7;padding:5px 12px;"><input  type="checkbox" id="bj" name="lwdwradio"   value="国土资源部"<s:if test='pageLucene.lwdw=="国土资源部"'>checked="checked"</s:if> style="margin-right:10px;" ><label for="bj">部级</label></div>
								<div style="float:left;display: inline;height:40px;border-left: 5px solid #CEE4F7;padding:5px 12px;"><input  type="checkbox" id="sj" name="lwdwradio"  value="省国土资源厅" <s:if test='pageLucene.lwdw=="省国土资源厅"'>checked="checked"</s:if> style="margin-right:10px;"><label for="sj">省级</label></div>
								<div style="float:left;display: inline;height:40px;border-left: 3px solid #CEE4F7;padding:5px 12px;"><input  type="checkbox" id="shizf" name="lwdwradio" value="宁波市政府集合" <s:if test='pageLucene.lwdw=="宁波市政府集合"'>checked="checked"</s:if> style="margin-right:10px;"><label for="shij">市政府</label></div>
								<div style="float:left;display: inline;height:40px;border-left: 5px solid #CEE4F7;padding:5px 12px;"><input  type="checkbox" id="shij" name="lwdwradio"  value="宁波市国土资源局" <s:if test='pageLucene.lwdw=="宁波市国土资源局"'>checked="checked"</s:if> style="margin-right:10px;"><label for="shij">市级</label></div>
								<div style="float:left;display: inline;height:40px;border-left: 5px solid #CEE4F7;padding:5px 12px;"><input  type="checkbox" id="qt" name="lwdwradio"  value="其他"  style="margin-right:10px;"><label for="qt">其他</label></div>
								<select class="form-control" id="qtlwdw" 
									style="width:150px;display:none;margin:5px;height:35px;font-size:13px;">
									<option value="市级机关">市级机关</option>
									<option value="宁波市人民政府">宁波市人民政府</option>
									<option value="市委">市委</option>
									<option value="县区级来文件">县区级来文件</option>
									<option value="市政府承办单">市政府承办单</option>
									<option value="省政府">省政府</option>
									<option value="中央、中央办公厅">中央、中央办公厅</option>
									<option value="省委">省委</option>
									<option value="宁波市发展和改革委员会">宁波市发展和改革委员会</option>
									<option value="国务院">国务院</option>
									<option value="其他">其他</option>
								</select>
								<input  type="hidden" id="inputlwdw" name="pageLucene.islwdwSearch" value="false"  >
								<input  type="hidden" id="lwdwStr" name="pageLucene.lwdw" value="false"  >
								<input  type="hidden" id="lwdwb" name="pageLucene.lwdwb" value="0" style="margin-right:10px;">
								<input  type="hidden" id="lwdws" name="pageLucene.lwdws" value="0" style="margin-right:10px;">
								<input  type="hidden" id="lwdwshi" name="pageLucene.lwdwshi" value="0" style="margin-right:10px;">
								<input  type="hidden" id="mutilLwdw" name="pageLucene.MutilLwdw" value="false" >
							</div>
						</div>
  						<div class="row file_list mt_20">
			  				<s:iterator value="pageLucene.results" id="file" status="stu">
								<div class="indexFile border_bottom" style="min-height: 100px;max-height:100px;overflow: hidden;">
									<div class="text-c"
										style="height:100%;width: 8%;float: left;padding:15px 8px;">
										<div class="<s:property value="#file.imageCssClass" />   ico_cnt ml_10"
											style="float: left;"></div>
									</div>
									<div style="width: 73%;float: left;min-height: 100px;">
										<div class="row ver-middle" style="float: left;padding-top:8px;">
											<div>
												<a class="ellipsis seePdf" title="<s:property
														value="#file.fileName" escape="false" />" href="dowloadFile.action?id=<s:property value="#file.fileId" />&indexFrom=<s:property value='#file.indexFrom'/>"
													target="_blank" style="margin-right: 5px;"><span>
													<s:property
														value="#file.fileName" escape="false" />
													</span></a>
											</div>
											<div>
												<span class="muted">
												<s:property value="#file.content" escape="false" />
												</span>
											</div>
											<div class="">
												<span class="muted">[所在位置] 
												<s:if test="#file.indexFrom==1">来源OA系统-收文编号：<s:property value="#file.SWBH" escape="false"  />-来文编号：<s:property value="#file.LWBH" escape="false" />
												-来文单位：<s:property value="#file.LWDW" />
												</s:if>
												<s:else><s:property
														value="#file.filePath" /></s:else>
												</span>
											</div>
										</div>
									</div>
									<div class="ver-middle"
										style="height: 100%;width: 15%;float: left;padding: 12px 8px;margin-left: 20px;">
										<span class="muted">上传人：<s:property
												value="#file.humanName" />
										</span> <br>
										<span class="muted"><s:property 
												value="#file.createTime" /> </span>
													<div class="">
												<a href="dowloadFile.action?id=<s:property value="#file.fileId" />&indexFrom=<s:property value='#file.indexFrom'/> " target="_blank" class=" " style="font-size: 12px;color: #06c;">下载</a>
												<a href="docPreview.action?fileId=<s:property value='#file.fileId'/>&indexFrom=<s:property value='#file.indexFrom'/>"  target="_blank" class="ml_10 seePdf" style="font-size: 12px;color: #06c;">预览</a>
												<a href="javascript:void(0)" id="<s:property value="#file.fileId" />" type='<s:property value="#file.indexFrom" />' class="ml_10 file_collect" style="font-size: 12px;color: #06c;">收藏</a>
											</div>
									</div>
								</div>
							</s:iterator>
		  				</div>
		  				<input type="hidden" id="isPage" name="pageLucene.isPage" value='false' >
		  				<!--分页按钮  -->
		  				<div class="row" style="margin-top: 20px;margin-bottom: 20px;">
  							<button class="btn btn-link prePage" <s:if test='pageLucene.hasPrePage==false' >disabled="disabled"</s:if> >上一页</button>
  							<input type="number" id="pageIndex" value='<s:property value="pageLucene.currentPage" />' style="width:80px;display: inline;" class="form-control">
  							<input type="number" id="currentPage" name="pageLucene.currentPage" value='<s:property value="pageLucene.currentPage"/>' style="display: none;">
  							<input id="totalPage" value='<s:property value="pageLucene.totalPageCount" />' style="display: none;">
  							<button class="btn btn-link nextPage" type="button" <s:if test='pageLucene.hasNextPage==false' >disabled="disabled"</s:if>>下一页</button>
  							共<span class="pageCount" ><s:property value="pageLucene.totalPageCount"/> </span>页，<s:property value="pageLucene.totalCount"/>条记录
  						</div>
  					</form>
  				</div>
  			</div>
  		</div>
  	</div>
  	<!--文件收藏的modal	  -->
  	<div class="modal fade" id="collectFileModal" tabindex="-1" role="dialog"
		aria-labelledby="exampleModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title" id="exampleModalLabel">文件收藏</h4>
				</div>
				<div class="modal-body">
					<span class="">请选择目标文件夹</span>
					<div class="row myDir_lists linktreeWrap margine_clear mt_10">
						<ul class="disk-copy-ul unstyled">
					  	  <li >
					      	  <a href="javascript:void(0);" class="myFirstDir" id="${personalDirId}">
					      	       <i class="diskpic-copy-right mgtDiskListArrows"></i>
					      	  </a>                                          
					      	  <span class="ch mgtActive"><i class="diskpic-smallbox"></i><span class="me-margin-left5">我的网盘</span></span>
					      </li>
						</ul>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" id="btn_collect" class="btn btn-primary">确定</button>
					<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
				</div>
			</div>
		</div>
	</div>
	<div id="pfdModal" class="modal fade">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-body">
					<iframe id="pdfIframe" name="pdfIframe" contextmenu="return false"
						scrolling="yes" src=""
						style="width:100%;height: 100%;@media print{ body{display:none} } ">
					</iframe>
				</div>
				<div class="">
					<div class="row">
						<div class="col-md-5"></div>
						<div class="col-md-4">
							<button type="button" class="btn btn-primary"
								data-dismiss="modal">返回</button>
							<!-- <button type="button" class="btn btn-danger print"
											>打印</button> -->
						</div>
						<div class="col-md-4"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
  <script type="text/javascript">
			laydate.skin('molv');
			laydate({
				elem : '#startDate'
			});
			laydate({
				elem : '#endDate'
			});
			$(function() {
				$(".prePage").on("click", function() {
					var pageCount = Number($("#currentPage").val()) - 1;
					$("#currentPage").val(pageCount);
					console.info($("#currentPage").val());
					searchType();
					lwdw();
					$("#isPage").val("true");
					$("#searchForm").submit();
				});
				$("#btn_search").on("click", function() {
					searchType();
					lwdw();
					$("#isPage").val("false");
					$("#searchForm").submit();
				});
				$(".nextPage").on("click", function() {
					var pageCount = Number($("#currentPage").val()) + 1;
					$("#currentPage").val(pageCount);
					console.info($("#currentPage").val());
					searchType();
					lwdw();
					$("#isPage").val("true");
					//window.location="http://localhost:8080/DocMan/pageSearch.action?currentPage="pageCount;
					$("#searchForm").submit();
				});

				$("#pageIndex").on(
						"keyup",
						function(event) {
							if (event.keyCode == "13") {
								var currentPage = Math.floor(Number($(
										"#pageIndex").val()));
								var totalPage = Number($("#totalPage").val());
								if (currentPage <= 0) {
									toast.error("请选择跳转的页数,或正确的页数", "温馨提示");
								}
								if (currentPage > totalPage) {
									toast.error("跳转页数不能大于总页数", "温馨提示");
								}
								$("#currentPage").val(currentPage);
								$("#searchForm").submit();
							}
						});
				$("[name='lwdwradio']").on("click", function() {
					var is_selected = $(this).is(':checked');
					var id = $(this).attr("id");
					$("[name='lwdwradio']").each(function(i, ele) {
						if (id != $(this).attr("id")) {
							$(this).attr("checked", false);
						}
					});
					if (id == "qt") {
						if ($("#qtlwdw").css('display') != "block") {
							$("#qtlwdw").toggle(300);
						}
					} else {
						if ($("#qtlwdw").css('display') == "block") {
							$("#qtlwdw").toggle(300);
						}
					}
					console.info($("#" + id).is(':checked'));
				})
				$(".file_list").on("click",".seePdf",function(){
					var url=$(this).attr("href");
					var height=$(window).height();
					var width=$(window).width();
					var pdf=$("#pfdModal");
					$("#pdfIframe").attr('src',url);
					$("#jnmlModal").modal('hide');
					pdf.find(".modal-body").css({
						height:height-60
					});
					pdf.find(".modal-dialog").css({
						width:width,
						height:height,
						margin:0
					});
					pdf.modal('show').css({
						 width: width,
			             height:height
					});
					return false;
				});
			});
			function searchType() {
				var d = $(".selected");
				console.info($(d).val());
				$("#searchType").val($(d).val());
				console.info($("#searchType").val());
			}
			function uploadfile() {
				var name = $("#upFile").val();
				var index = name.lastIndexOf("\\");
				var fileName = name.substring(index + 1, name.length);
				var file = document.getElementById('upFile').files[0];
				var fileSize = "";
				if (file.size > 1024 * 1024)
					fileSize = (Math.round(file.size * 100 / (1024 * 1024)) / 100)
							.toString()
							+ 'MB';
				else
					fileSize = (Math.round(file.size * 100 / 1024) / 100)
							.toString()
							+ 'KB';
				console.info(name + fileSize + fileName);
				$.ajaxFileUpload({
							url : "asynUpload.action",
							secureuri : false,
							fileElementId : 'upFile',
							dataType : 'json',
							success : function(data, status) {
								console.info(data);
								var filePath = data.filePath;
								console.info(filePath);
								var file = "<div class=\"row file\">"
										+ "<div class=\"col-xs-6\">"
										+ "<span class=\"\">"
										+ fileName
										+ "</span>"
										+ "</div>"
										+ "<div class=\"col-xs-4\">"
										+ "<span class=\"muted fileSize \" id=\""+fileSize+"\"> ("
										+ fileSize
										+ ") </span>"
										+ "<button value=\""+filePath+"\" class=\"btn btn-link padding_clear filePath\">删除</button>"
										+ "</div>" + "</div>";
								$("#fileUploadList").append(file);
								//$("#serverFilePath").val(filePath);
							},
							error : function(data, status) {
								console.info(data);
							}
						});
			}
			function clickinput() {
				return $("#upFile").click();
			}
			function lwdw() {
				/* if($("#islwdwsearch").is(':checked')){
					$("#inputlwdw").val("true");
				}else{
					$("#inputlwdw").val("false");
				} */
				/* if($("#bj").is(':checked'))
				{
					$("#lwdwb").val("1");
					console.info($("#lwdwb").val())
				}
				if($("#sj").is(':checked'))
				{
					$("#lwdws").val("1");
					console.info($("#lwdws").val())
				}
				if($("#shij").is(':checked'))
				{
					$("#lwdwshi").val("1");
					console.info($("#lwdwshi").val())
				}	 */
				$("#inputlwdw").val("false");
				var lwdw = "";
				$("[name='lwdwradio']").each(function(i, ele) {
					if ($(ele).is(":checked")) {
						$("#inputlwdw").val("true");
						lwdw = $(ele).val();
					}
				});
				if(lwdw=="宁波市政府集合"){
					$("#mutilLwdw").val("true");
				}else{
					$("#mutilLwdw").val("false");
				}
				if (lwdw == "其他") {
					lwdw = $("#qtlwdw").val();
				}
				$("#lwdwStr").val(lwdw);

				console.info(lwdw);
			}
			$("#high_search").on("click", function() {
				$("#div_time").toggle(500);
				$("#div_lwdw").toggle(500);
				if ($("#icon").hasClass("glyphicon-chevron-right")) {
					$("#icon").removeClass("glyphicon-chevron-right");
					$("#icon").addClass("glyphicon-chevron-down");
				} else {
					$("#icon").removeClass("glyphicon-chevron-down");
					$("#icon").addClass("glyphicon-chevron-right");
				}
			})
			$(function() {
				//通用头部搜索切换
				$('#search-hd .search-input').on(
								'input propertychange',
								function() {
									var val = $(this).val();
									if (val.length > 0) {
										$('#search-hd .pholder').hide(0);
									} else {
										var index = $('#search-bd li.selected')
												.index();
										$('#search-hd .pholder').eq(index)
												.show().siblings('.pholder')
												.hide(0);
									}
								})
				$('#search-bd li').click(
						function() {
							var index = $(this).index();
							$('#search-hd .pholder').eq(index).show().siblings(
									'.pholder').hide(0);
							$('#search-hd .search-input').eq(index).show()
									.siblings('.search-input').hide(0);
							$(this).addClass('selected').siblings()
									.removeClass('selected');
							/* $('#search-hd .search-input').val(''); */
						});
			})
		</script>
</html>
